<!doctype html>
<html>
<head>
<title>Alert</title>
<script type="text/javascript">
  window.onbeforeunload = function (e) {
	  var message = "Your confirmation message goes here.",
	  e = e || window.event;
	  // For IE and Firefox
	  if (e) {
	    e.returnValue = message;
	  }

	  // For Safari
	  return message;
	};
</script>
</head>
<body>
	<a href="https://www.baidu.com">baidu</a>
</body>
</html>